<%@ page language="java" contentType="text/html; charset=utf-8"
	import="com.zzty.taskapp.entity.User" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ZZTY</title>
<!-- BOOTSTRAP STYLES-->
<link href="../css/bootstrap.css" rel="stylesheet" />

<!-- CUSTOM STYLES-->
<link href="../css/custom.css" rel="stylesheet" />
<script>
	function a() {
		var phone = document.all.phone1.value;
		var disname = document.all.disname1.value;
		var email = document.all.email1.value;
		if (phone.length != 11 || disname.length < 1 || email.length < 1) {
			alert("信息填写错误或不能为空");
			return false;

		} else {
			return true;

		}

	}
	function b() {
		var photo = document.all.Photo.value;
		if (photo == " " || photo == null) {
			alert("提交照片不能为空");
			return false;
		} else {
			return true;
		}

	}
</script>
</head>
<body>
	<%
		String name = "", Email = "", Phone = "", Sex = "", Classes = "", img = "", disname = "";
		User user = (User) request.getSession().getAttribute("user");
		if (user != null) {
			name = (String) request.getSession().getAttribute("Name");
			Email = (String) user.getEmail();
			Phone = (String) user.getPhone();
			Sex = (String) user.getSex();
			if ("boy".equals(Sex)) {
				Sex = "男";
			} else {
				Sex = "女";
			}
			Classes = (String) user.getClasses();
			img = (String) user.getImg();
			disname = (String) user.getDisname();
		}
	%>
	<div id="wrapper">
		<nav class="navbar navbar-default navbar-cls-top " role="navigation"
			style="margin-bottom: 0">
			<div class="navbar-header">
				<!--                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse"> -->
				<!--                     <span class="sr-only">Toggle navigation</span> -->
				<!--                     <span class="icon-bar"></span> -->
				<!--                     <span class="icon-bar"></span> -->
				<!--                     <span class="icon-bar"></span> -->
				<!--                 </button> -->
				<a class="navbar-brand">自在天原</a>
			</div>
			<div
				style="color: white;padding: 15px 50px 5px 50px;float: right;font-size: 16px;">
				<form action="../loginOut.jsp" method="post">
					<button type="submit" class="btn btn-danger">注销</button>
				</form>
			</div>
		</nav>
		<!-- /. NAV TOP  -->
		<nav class="navbar-default navbar-side" role="navigation">
			<div class="sidebar-collapse">
				<ul class="nav" id="main-menu">
					<li class="text-center"><img src="<%=img%>"
						class="user-image img-responsive" /></li>


					<li><a href="../index.jsp"><i
							class="fa fa-dashboard fa-3x"></i> 主页</a></li>
					<li><a href="UserInfo.jsp"><i class="fa fa-table fa-3x"></i>
							个人信息</a></li>
					<li><a href="SelfExam.jsp"><i class="fa fa-desktop fa-3x"></i>
							今日竞赛</a></li>
					<li><a href="TeamExam.jsp"><i class="fa fa-qrcode fa-3x"></i>
							今日结对</a></li>
					<li><a href="History.jsp"><i
							class="fa fa-bar-chart-o fa-3x"></i> 历史记录</a></li>

					<li><a href="ChangePassword.jsp"><i
							class="fa fa-edit fa-3x"></i> 密码修改 </a></li>


				</ul>

			</div>

		</nav>
		<!-- /. NAV SIDE  -->
		<div id="page-wrapper">
			<div id="page-inner">
				<div class="row">
					<div class="col-md-12">
						<div class="table-responsive">
							<table class="table">
								<caption>
									<h2>个人信息</h2>
								</caption>

								<thead>
									<tr>
										<th>账号</th>
										<td><%=name%></td>
									</tr>
								</thead>
								<tbody>
									<tr>
										<th>姓名</th>
										<td><%=disname%></td>
									</tr>
									<tr>
									<tr>
										<th>邮箱</th>
										<td><%=Email%></td>
									</tr>
									<tr>
										<th>手机</th>
										<td><%=Phone%></td>
									</tr>
									<tr>
										<th>性别</th>
										<td><%=Sex%></td>
									</tr>
									<tr>
										<th>班级</th>
										<td><%=Classes%>班</td>
									</tr>
								</tbody>
							</table>
							<button class="btn btn-primary btn-lg" data-toggle="modal"
								data-target="#myModal">修改信息</button>
							<button class="btn btn-primary btn-lg" data-toggle="modal"
								data-target="#myModal1">修改头像</button>
						</div>

					</div>
				</div>
				<!-- /. ROW  -->
				<hr />

			</div>
			<!-- /. PAGE INNER  -->
		</div>
		<!-- /. PAGE WRAPPER  -->
	</div>
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title" id="myModalLabel">修改用户信息</h4>
				</div>
				<form action="../InfoChange?method=infocg" method="post"
					onsubmit="return a()">
					<div class="modal-body">
						<div class="table-responsive">
							<table class="table">

								<tr>
									<th>姓名</th>
									<td><input type="text" class="form-control"
										name="disname1" placeholder="请输入姓名" value="<%=disname%>"></td>
								</tr>
								<tr>
									<th>邮箱</th>
									<td><input type="email" class="form-control" name="email1"
										placeholder="请输入邮箱" value="<%=Email%>"></td>
								</tr>
								<tr>
									<th>手机</th>
									<td><input type="text" class="form-control" name="phone1"
										onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入手机"
										value="<%=Phone%>"></td>
								</tr>
								<tr>
									<th>性别</th>
									<td><label><input name="sex1" type="radio"
											value="boy" checked="checked" />男 </label> <label><input
											name="sex1" type="radio" value="girl" />女<br> </label></td>
								</tr>
								<tr>
									<th>班级</th>
									<td><select name="class1">
											<option value="1">1班</option>
											<option value="2">2班</option>
											<option value="3">3班</option>
											<option value="4">4班</option>
											<option value="5">5班</option>
									</select></td>
								</tr>
							</table>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">
							关闭</button>
						<input type="submit" class="btn btn-primary" value="提交更改">
					</div>
				</form>

			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->

	<div class="modal fade" id="myModal1" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title" id="myModalLabel">修改用户信息</h4>
				</div>
				<form action="../InfoChange?method=imgChange" method="post"
					enctype="multipart/form-data" onsubmit="return b()">
					<div class="form-group">
						<input type="file" name="Photo" accept="image/*">
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">
							关闭</button>
						<button type="submit" class="btn btn-primary">提交更改</button>
					</div>
				</form>

			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->

	<!-- /. WRAPPER  -->
	<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
	<!-- JQUERY SCRIPTS -->
	<script src="../js/jquery-1.10.2.js"></script>
	<!-- BOOTSTRAP SCRIPTS -->
	<script src="../js/bootstrap.min.js"></script>
	<!-- METISMENU SCRIPTS -->
	<script src="../js/jquery.metisMenu.js"></script>



</body>
</html>
